import type { FormInstance } from "element-plus";
import { fa } from "element-plus/es/locales.mjs";

/**
 * base64转换为图片
 * @param base64
 * @returns
 */
export const convertBase64ToJpg = (base64: string) => {
  const base64Data = base64.replace(/^data:image\/\w+;base64,/, "");
  const binaryString = window.atob(base64Data);
  const len = binaryString.length;
  const bytes = new Uint8Array(len);
  for (let i = 0; i < len; i++) {
    bytes[i] = binaryString.charCodeAt(i);
  }
  const blob = new Blob([bytes], { type: "image/jpeg" });
  return URL.createObjectURL(blob);
};

